﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ETL.Business.Handlers.ProjectTaskHandler;
using ETL.Business.Handlers.SessionHandler;
using ETL.Business.Models;
using ETL.Common;

namespace ETL.Business.Helpers
{
    public class ShowTasks
    {
        public virtual IEnumerable<ProjectTaskModel> Execute(short? projectId)
        {
            // Get loading 
            string loading = (new GetSessionData()).Execute(Constants.SessionVars.Loading);
            if(loading.Equals("True"))
            {
                return null;
            }

            // get task from db
            var allTasks = (new GetProjectTaskToList()).Execute(projectId);

            // update task color

            // set loading to false
            (new SetSessionData()).Execute(Constants.SessionVars.Loading, "False");

            var k = allTasks.ToList();

            return allTasks;

        }
    }
}
